#include "StdAfx.h"
#include "Helper.h"
#include <GameLogic/BoardLogicBase.h>
#include <IGUIElement.h>

namespace catan
{
/*	Helper mHelper;*/

	int Helper::GetBoardId() const
	{
		return (int)GetBoard().Id();
	}

	scene::ISceneNode* Helper::GetBoardNode()
	{
		return mDevice->getSceneManager()->getSceneNodeFromId(GetBoardId());
	}

	scene::ISceneManager* Helper::GetSceneManager()
	{
		return mDevice->getSceneManager();
	}

	Handle<Board> Helper::GetBoard() const
	{
		return mBoardLogic->GetBoard();
	}

	ISceneNode* Helper::AddAnimatioMeshNode( const tstring& filename, ISceneNode* parent /*= 0*/, s32 id /*= -1*/, IAnimatedMesh** retMesh /*= 0*/ )
	{
		IAnimatedMesh* mesh = mDevice->getSceneManager()->getMesh(filename.c_str());
		VALID(mesh);
		ISceneNode* ret = mDevice->getSceneManager()->addAnimatedMeshSceneNode(mesh, parent, id);
		if (retMesh)
		{
			*retMesh = mesh;
		}
		
		VALID(ret);
		return ret;
	}

	gui::IGUIElement* Helper::GetGUIElement( s32 id )
	{
		return mDevice->getGUIEnvironment()->getRootGUIElement()->getElementFromId(id, true);
	}

	
}